package com.hp.bon.sgw.wh.channel.outside;

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import com.hp.bon.sgw.wh.channel.common.BizConsts;

public class OutApiCapabilities {

	private static final Map<String, String> capabilities = new HashMap<String, String>();
	static {
		// 对外计费web接口
		capabilities.put("QueryStopNet.HB", BizConsts.TYPE_API_CAPABILITY_WS);
		capabilities.put("QueryBlackOwe.HB", BizConsts.TYPE_API_CAPABILITY_WS);
		capabilities.put("PayBlackOwe.HB", BizConsts.TYPE_API_CAPABILITY_WS);
		capabilities.put("RechargeExtract.BestPay", BizConsts.TYPE_API_CAPABILITY_WS);
	}
	
	private static final Set<String> zwLatnCcapabilities = new HashSet<String>();
	static {
		// zw_latn判断：
		// zw_latn=1001, 1018--省内本地网判断标示，针对根据latn_id参数判断路由的接口
		zwLatnCcapabilities.add("QueryStopNet.HB");
	}
	
	public static Set<String> listOutApiCapabilities() {
		return Collections.unmodifiableSet(capabilities.keySet());
	}
	
	public static boolean hasCapability(String capability) {
		return capabilities.containsKey(capability);
	}
	
	public static boolean isWSCapability(String capability) {
		if(BizConsts.TYPE_API_CAPABILITY_WS.endsWith(capabilities.get(capability))) {
			return true;
		}
		return false;
	}
	
	public static boolean isHttpCapability(String capability) {
		if(BizConsts.TYPE_API_CAPABILITY_HTTP.endsWith(capabilities.get(capability))) {
			return true;
		}
		return false;
	}
	
	public static Set<String> listZwLatnCcapabilities() {
		return Collections.unmodifiableSet(zwLatnCcapabilities);
	}
	
	public static boolean zwLatnCapability(String capability) {
		return zwLatnCcapabilities.contains(capability);
	}
	
}
